<template>
    <el-container class="total">
        <el-container>
            <el-header style="border-top: solid 2px #b2b4b4;margin-right: 20px;">警营文化</el-header>
            <el-main style="border-radius: 10px; border: 1px solid #ccc; padding: 15px;margin-right: 20px;">
                <div>
                    <el-table :data="PoliceTableData" style="width: 100%">
                        <el-table-column prop="content" label="内容" :width="contentWidth">
                        </el-table-column>
                        <el-table-column prop="time" label="时间" :width="timeWidth">
                        </el-table-column>
                    </el-table>
                </div>
            </el-main>
            <el-footer>
                <el-pagination class="PolicePage" @size-change="handleSizeChange" @current-change="handleCurrentChange"
                    :current-page="currentPage" :page-sizes="[10, 20, 30, 40]" :page-size="pageSize"
                    layout="total, sizes, prev, pager, next, jumper" :total="total">
                </el-pagination>
            </el-footer>
        </el-container>
        <el-aside width="300px">
            <ErJiWangZhan></ErJiWangZhan>
            <div class="custom-yingyongxitong">
                <YingYongXiTong></YingYongXiTong>
            </div>
            <div class="WebsiteNail">
                <WebsiteNail></WebsiteNail>
            </div>
        </el-aside>
    </el-container>
</template>
<script>
// 导入要引入的组件
import ErJiWangZhan from '@/components/index/ErJiWangZhan.vue';
import WebsiteNail from '@/components/index/WebsiteNail.vue';
import YingYongXiTong from '@/components/index/YingYongXiTong.vue';

export default {
    components: {
        ErJiWangZhan,      //二级网站
        WebsiteNail,
        YingYongXiTong
    },
    data() {
        return {
            PoliceTableData: [],
            contentWidth: '600px', // 内容列的宽度
            timeWidth: '300px',     // 时间列的宽度
            currentPage: 1, // 当前页数
            pageSize: 10, // 每页显示条数
            total: 0, // 总条数
        }
    },
    mounted() {
        // 获取数据
        this.getPoliceData();
    },
    methods: {
        // 获取数据方法
        getPoliceData() {
            const PoliceData = [{
                content: 'xxxxxxxxxxxx',
                time: '2024-2-31',
            }, {
                content: 'xxxxxxxxxxxx',
                time: '2024-2-31',
            }, {
                content: 'xxxxxxxxxxxx',
                time: '2024-2-31',
            }, {
                content: 'xxxxxxxxxxxx',
                time: '2024-2-31',
            }, {
                content: 'xxxxxxxxxxxx',
                time: '2024-2-31',
            }, {
                content: 'xxxxxxxxxxxx',
                time: '2024-2-31',
            }, {
                content: 'xxxxxxxxxxxx',
                time: '2024-2-31',
            }, {
                content: 'xxxxxxxxxxxx',
                time: '2024-2-31',
            }, {
                content: 'xxxxxxxxxxxx',
                time: '2024-2-31',
            }, {
                content: 'xxxxxxxxxxxx',
                time: '2024-2-31',
            }, {
                content: 'xxxxxxxxxxxx',
                time: '2024-2-31',
            }];
            this.total = PoliceData.length; // 总条数
            this.PoliceTableData = PoliceData.slice((this.currentPage - 1) * this.pageSize, this.currentPage * this.pageSize); // 分页后的数据
        },
        // 每页显示条数变化时触发
        handleSizeChange(val) {
            this.pageSize = val;
            this.currentPage = 1; // 重置页数
            this.getPoliceData();
        },
        // 当前页数变化时触发
        handleCurrentChange(val) {
            this.currentPage = val;
            this.getPoliceData();
        }
    }
};
</script>
<style scoped>
.el-header {
    font-size: 35px;
    line-height: 35px;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: #0a7ebb;
}

.custom-yingyongxitong /deep/ .newsType {
    display: flex;
    background-color: whitesmoke;
}

.custom-yingyongxitong /deep/ .title {
    width: 50%;
    height: 40px;
    border-bottom: 1px solid #b2b4b4;
    padding-left: 10px;
    font-size: 20px;
    color: whitesmoke;
    background-color: rgb(72, 157, 226);
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.custom-yingyongxitong /deep/ .more {
    width: 50%;
    border-bottom: 1px solid #b2b4b4;
    justify-content: right;
}

.custom-yingyongxitong /deep/ .icon-container>i {
    margin-right: 20px;
    font-size: 20px;
    color: #0a7ebb;
    ;
}

.custom-yingyongxitong /deep/ .jump-link>div {
    margin: 0 5px;
    display: flex;
    border: none;
    font-size: 16px;
    height: 35px;
    color: black;
    justify-content: flex-start;
    /* Right-align the content */
    margin-bottom: 5px;
    background-color: transparent;
}

.PolicePage {
    margin-top: 8px;
    display: flex;
    justify-content: center;
    /* 水平居中 */
    align-items: center;
    /* 垂直居中 */
}
</style>